package dto

import (
	"service/app/mode"
	"time"
)

type Ipm_roles struct {
	// Id    int   `uri:"id" binding:"required" required_msg:"id 为必填项目" validate:"required"`
	Roles []int `json:"roles" form:"roles" binding:"required"  required_msg:"roles 为必填项目"`
}
type Ipm_pmIntList struct {
	// Id    int   `uri:"id" binding:"required" required_msg:"id 为必填项目" validate:"required"`
	Pm []int `json:"perm" form:"perm" binding:"required"  required_msg:"perm 为必填项目[]int"`
}
type Ipm_pmUrlList struct {
	// Id    int   `uri:"id" binding:"required" required_msg:"id 为必填项目" validate:"required"`
	Pm []string `json:"urls" form:"urls" binding:"required"  required_msg:"urls 为必填项目[]string"`
}

type Ipm_add struct {
	Url      string `json:"url" form:"url" binding:"required" required_msg:" url 为必填项目" validate:"required"`
	Method   string `json:"method" form:"method" binding:"required" required_msg:" method 为必填项目" validate:"required"`
	Desc     string `json:"desc" binding:"max=65"`
	Fullpath string `json:"fullpath" form:"fullpath" binding:"required" required_msg:" fullpath 为必填项目" validate:"required"`
}

type Ipm_addList struct {
	Paths []mode.Db_pm `json:"paths" binding:"required" required_msg:"paths 为必填项目" validate:"required,dive"`
}

type Pm_listDto struct {
	Id              uint      `json:"id" form:"id"`
	User            string    `json:"user" form:"user" binding:"required" required_msg:"用户名为必填项目"`
	Password        string    `json:"password,omitempty" form:"password" binding:"required" required_msg:"password为必填项目"`
	Gender          int       `json:"gender" form:"gender" binding:"required" required_msg:"Gender 为必填项目"`
	Last_Login_Ip   string    `json:"last_login_ip" form:"last_login_ip" binding:"required" required_msg:"Last_Login_Ip 为必填项目"`
	User_Level_Id   int       `json:"user_level_id" form:"user_level_id" binding:"required" required_msg:"User_Level_Id 为必填项目"`
	Nickname        string    `json:"nickname" form:"nickname" binding:"required" required_msg:"Nickname 为必填项目"`
	Mobile          string    `json:"mobile" form:"mobile" binding:"required" required_msg:"Mobile 为必填项目"`
	Avatar          string    `json:"avatar" form:"avatar" binding:"required" required_msg:"Avatar 为必填项目"`
	Birthday        time.Time `json:"birthday" form:"birthday" binding:"required" required_msg:"Birthday 为必填项目"`
	Last_Login_Time time.Time `json:"last_login_time" form:"last_login_time" binding:"required" required_msg:"Last_Login_Time 为必填项目"`
	Register_Ip     string    `json:"register_ip" form:"register_ip" binding:"required" required_msg:"Register_Ip 为必填项目"`
	Role            []string  `json:"role"`
}

type IacApi struct {
	Url    string
	Method string
}

func (m *Ipm_add) CoverPm() *mode.Db_pm {
	var savePm mode.Db_pm
	savePm.Url = m.Url
	savePm.Method = m.Method
	savePm.Desc = m.Desc
	savePm.Fullpath = m.Fullpath
	return &savePm
}
